package controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class MyController {
    @RequestMapping("/")
    public String toIndex(){
        return "index";
    }
    @RequestMapping("/loading")
    public String loading(String username,String password){
        if(username.equals("admin")&&password.equals("123456")){
            System.out.println(username+"登录");
            return "success";
        }
        return "index";
    }
    @RequestMapping("/displayInfo")
    public String displayInfo(Model model,User user){
        System.out.println(user);
        model.addAttribute("name",user.getName());
        model.addAttribute("gender",user.getGender());
        return "displayInfo";
    }
}
